
import {get, post,put,del,waiwang} from '@/js/http'

// 用户
export const login = (params) => {return post('shops/user/index/login', params)}
export const register = (params) => {return post('shops/user/index/register', params)}
export const checkExistUser = (params) => {return get('shops/user/index/findByUser', params)}
export const findByUserInfo = (params) => {return get('shops/user/findByUserInfo', params)}
export const findById = (params) => {return get('shops/user/findById/'+ params)}
export const updateUser = (params) => {return put('shops/user/update', params)}

// 用户地址
export const addressByUser = (id,params) => {return get('shops/userAddress/findByUser/'+ id,params)}
export const addAddress = (params) => {return post('shops/userAddress/addAddress', params)}
export const deleteAddress = (params) => {return del('shops/userAddress/deleteAddress', params)}

// 商品展示
export const findAllGoods = (params) => {return get('shops/showGoods/index/findAll', params)}
export const findByIdGoods = (params) => {return get('shops/showGoods/index/findById/'+ params)}
  /**首页 */
export const getRandomGoods = (params) => {return get('shops/system/goods/random' , params)}
export const getDefaultData = (params) => {return get('shops/system/goodsType/getDefaultData' , params)}
  /**搜索 */
export const findGoodsBySearch = (params) => {return get('shops/system/goods/findGoodsBySearch' , params)}


// 购物车
export const findGoodsCar = (params) => {return get('shops/goodsCar/findAll', params)}
export const addGoodsCar = (params) => {return get('shops/goodsCar/addGoodsCar', params)}
export const findByGoodsCar = (params) => {return get('shops/goodsCar/findByGoodsCar', params)}
export const deleteGoodsCar = (params1,params2) => {return del('shops/goodsCar/deleteGoodsCar/'+ params1 +"/" +params2)}
export const deleteGoodsCars = (params) => {return del('shops/goodsCar/deleteGoodsCars',params)}
export const updateGoodsCarNums = (params) => {return put('shops/goodsCar/updateGoodsCarNums', params)}

// 支付
export const payMoney = (params) => {return post('shops/zfb/pay', params)}
export const toPay = (params) => {return post('shops/zfb/toPay', params)}
export const cancelOrder = (params) => {return del('shops/zfb/cancelOrder', params)}
export const testIndex = (params) => {return waiwang('shops/zfb/pay', params)}
export const addOrder = (params) => {return post('shops/system/order/goodsCar/addOrder', params)}
export const findByUserOrders = (params) => {return get('shops/system/order/findByUserOrders', params)}

